<?php

class PageController extends FrontendController
{
    /**
     * @param $name
     * @throws CHttpException
     */
	public function actionIndex($name)
	{
	    //var_dump($name);exit;
	    if(!$name)
            throw new CHttpException(404,'The requested page does not exist.');

        $model=Article::model()->findByAttributes( array('sub_title'=>$name) );
        //$model=Article::model()->find('sub_title=:title', array(':title' => $name));
        //var_dump($model);exit;
        if($model===null)
            throw new CHttpException(404,'The requested page does not exist.');
		$this->render('view',array(
			'model'=>$model,
		));
	}


}
